home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Experimental BBS Explossion 3
/
Experimental BBS Explossion III.iso
/
pascal
/
bp7sb103.zip
/
BP7SB.DOC
< prev
next >
Wrap
Text File
|
1993-09-03
|
11KB
|
397 lines
▄▄▄▄▄▄▄▄▄
█ BP7SB █
▀▀▀▀▀▀▀▀▀
Thank you for trying BP7SB!
BP7SB is a Source Beautifier for Turbo / Borland Pascal sources.
(up to Version 7.0) Use it only at your own risk!
Please report all bugs and comments to the author:
Jozsef Ferincz
Bleibtreustr. 32
D-10707 Berlin
Germany
Phone: +49 30 8835822
E-Mail: ferincz@chemie.fu-berlin.de
ferincz@fub.uucp
════════════════════════════════════════════════════════════════════════════
Introduction
────────────
BP7SB is a useful tool with many options to format Pascal code in a
consistent form. BP7SB uses default values to reformat the source
code, but with the options you can develop another shape. It makes
your code OPTICALLY beautiful.
BP7SB - if you want - makes keyword conversion (lower, mixed, upper
case or according to your own pattern or takes the first
occurrence - only for user words) separately switchable
for the keyword classes, which are: functions, procedures,
reserved words, types, variables and constants, TVision
keywords, user words, the own words will be taken from
your 'own words collection'.
BP7SB - if you want - structures loops.
BP7SB - if you want - indents record and object structures.
BP7SB - if you want - sets the length of source code line.
BP7SB - if you want - inserts space characters to make your source
code easier readable.
BP7SB - if you want - replaces TAB characters by 8 space characters.
BP7SB - if you want - identifies loops. (at the keyword 'END')
BP7SB - if you want - makes extra indents after not_closed_brackets.
BP7SB - if you want - reads the options from a file.
BP7SB does not check for syntax errors, but you can recognize some of
the syntax errors after structuring by BP7SB. BP7SB also works in the
IDE of Turbo / Borland Pascal. (see in BP7SB-in.IDE)
BP7SB recognizes the following built-in keywords:
739 functions
197 procedures
62 reserved words
94 types
409 variables and constants
615 TVision keywords
════════════════════════════════════════════════════════════════════════════
Syntax:
───────
BP7SB [options] source[.PAS]
The order of arguments is not significant. The arguments are not
case sensitive. If you use -a or -b:<f|p|r|t|v> options, you will
get your information on a standard output and after that the
program terminates, also if you use other command options.
Command options followed by : (colon) must have ONE parameter,
which will follow immediately after the option with no space.
The original source file will be saved as a *.BAK backup file.
BP7SB does not use .BAK, .COM, .DLL, .EXE, .OBJ, .RES, .TPP, .TPU
or .TPW files as input. If you don't use an extension after the
input file name, .PAS will be added. Standard wildcards may
be used.
Comments in { } or in (* *) and strings in ' ' or " " will not be
altered in the source.
Options:
────────
-a Gives you a short info about BP7SB.
-b:<f|n|p|r|t|v> Puts the built-in keywords to a standard output.
The keyword groups are: f-functions, n-TVision, p-procedures,
r-reserved words, t-types, v-variables and constants. If you want to
see more than one keyword group, you may use this option several times.
The following example gives you all built-in keywords:
BP7SB -b:f -b:n -b:p -b:r -b:t -b:v | more
-c:file Read options from a file.
You may save the frequently used options in a file. The options
can also be in several lines. The contents of a line is ignored
from the # character. The separators of options are the space, the
end of line and the end of file characters. The options saved in
the file may be updated by a command line. You may save all options
in the file except -a, -b:<f|p|r|t|v> and -c:file options. If the
file isn't in the active directory, you should use the complete
path. If you don't use this option, BP7SB looks for the file
BP7SB.INI in the actual directory in order to read the options.
If BP7SB.INI is not found in the actual directory, BP7SB looks
for BP7SB.INI in the 'HOME' directory of BP7SB.
If myoption.cfg is:
-d:3 -f:u
#-y:5
-y:6
-r:u
You may use:
BP7SB -c:myoption.cfg -y:1 mysource.pas
-d:n Switches structuring off or sets the depth of structures.
Accepted values of n are between 0 and 10. Default value of n is 2.
If n is 0, the source code will be not structured, the original
structure will be kept. (In this case [-d:0] you cannot use the
option -l.)
BP7SB -d:3 mysource.pas
-e All TAB characters found in the source code will be replaced
by 8 space characters.
BP7SB -e mysource.pas
-<f|n|p|r|t|v>:<u|l> Switches the case of built-in keywords.
The groups of built-in keywords are: functions, TVision keywords,
procedures, reserved words, types, variables and constants. You
can choose upper or lower case. Default is mixed case: WriteLn.
In upper case: WRITELN, in lower case: writeln. (You can redefine
it with the option -o:file if you like. e.g.: WRITEln)
BP7SB -r:u -t:l -v:u mysource.pas
-i:<e|n> Controls how to 'extra indent' after not_closed_brackets
One extra indent for each not_closed_bracket or do not extra indent.
Default is one extra indent for all not_closed_brackets. (i.e. the
next lines get only one extra indent even if the source line has
more than one not_closed_brackets)
If mysource.pas looks like that:
...
while (not eof(infile)) or
(((i > counter) or
(b = 2)) and
(c <> 'n')) or
(d >= 10) do
...
After using BP7SB mysource.pas you will get:
...
While (Not EoF(Infile)) Or
(((I > Counter) Or
(B = 2)) And
(C <> 'n')) Or
(D >= 10) Do
...
After using BP7SB -i:e you will get:
...
While (Not EoF(Infile)) Or
(((I > Counter) Or
(B = 2)) And
(C <> 'n')) Or
(D >= 10) Do
...
-k Keep source compact
If you use this option then BP7SB does not insert space characters,
does not structure record and object definitions, does not make any
extra indent on lines after _not_closed_brackets_.
If mysource.pas looks like that:
type
Date=record
D,
M,
Y:Integer;
end;
...
if(a<b)or(c=d)then
begin
writeln((a+b)*c,(d^.e-5)/f[(a+b)*g.h]);
a:=d^.e
end;
If you use the -k option, BP7SB will not make:
{BP7SB mysource.pas}
Type
Date = Record
D,
M,
Y: Integer;
End;
...
If (a < b) Or (c = d) Then
Begin
WriteLn ( (a + b) * c, (d^. e - 5) / f [ (a + b) * g. h] );
a := d^. e
End;
but you will get:
{BP7SB -k mysource.pas}
Type
Date=Record
D,
M,
Y:Integer;
End;
...
If(a<b)Or(c=d)Then
Begin
WriteLn((a+b)*c,(d^.e-5)/f[(a+b)*g.h]);
a:=d^.e
End;
-l Identifies loops
If you use this option you will get _loop_identifiers_ after the
keyword 'END'. The _loop_identifier_ will not be inserted if you
already have some comment - in the same line beginning with
'{' or '(' - after the actual 'END', but if you have at least
2 space characters after the keyword 'END', the _loop_identifier_
will be inserted. If you change the loop in your source code and
run BP7SB a 2nd time, the _loop_identifier_ will NOT be overwritten.
The _loop_identifiers_ have the same case as the reserved words.
The _loop_identifiers_ are:
{ with }
{ while }
{ if }
{ if else }
{ for }
{ case }
{ case else }
{ case label }
{ record }
{ object }
{ asm }
{ ? }
The 'END's of Program, Unit, Procedure, Function, Constructor,
Destructor and the unrecognized loops will marked with { ? }.
If mysource.pas looks like that:
...
case n of
1: begin
...
with a^. do
begin
...
for i := 1 to k do
begin
...
if i > n then
begin
...
writeln(i - n);
end
else
begin
...
writeln(n);
end;
end;
end;
end;
2: writeln(n);
else
begin
...
writeln(n - 1);
end;
end;
...
After using BP7SB -l mysource.pas
...
Case N Of
1: Begin
...
With A^. Do
Begin
...
For I := 1 To K Do
Begin
...
If I > N Then
Begin
...
WriteLn (I - N);
End { If }
Else
Begin
...
WriteLn (N);
End; { If Else }
End; { For }
End; { With }
End; { Case Label }
2: WriteLn (N);
Else
Begin
...
WriteLn (N - 1);
End; { Case Else }
End; { Case }
...
-o:file Use collection of own words
You may give the format of your own words (variables, constants,
types, functions, procedures, ...) in your source code. You may
also redefine the built-in keywords. BP7SB will use this collection
of own words like the built-in keywords. The words in this file
may have characters only from [a..z,_,A..Z,0-9]. All other characters
will be interpreted as separator of words. If you have one word several
times in this file, the last version will be used. The contents of
a line will be ignored from the # character. Your own words may have
a maximal length of 26 characters.
If mywords.txt is:
MyFunction MyCONSTANT
#WRITEln
writeLN, MYvar
You may use:
BP7SB -o:mywords.txt mysource.pas
-s:m Length of line in the source code
Default value is 255 characters: function OFF. BP7SB does not
make the source not shorter than 40 characters and does not insert
EoLn character after 255 characters. (The source line can be
longer.)
BP7SB -s:120 mysource.pas
-u:<f|u|l|n> Defines the case of user words
User words are the keywords in the source code, which do not match
neither to any built-in nor to any own words. (given by the
option -o:file). f - first occurrence, u - upper, l - lower
case, n - no convert, take it 'as is'. Default is mixed case:
the first character and the character after '_','0'..'9' will be
converted to capitals.
BP7SB -u:f mysource.pas
-w No conversion of any keywords
BP7SB -w mysource.pas
-y:z Position of lines beginning with { or (* character(s)
If the line in the source code begins with a comment or a compiler
directive, you may define at which column of source this line
begins. The numbering of columns begins with 1. If you don't use
this option, the lines beginning with { or (* character(s) will
be structured like other lines.
BP7SB -y:1 mysource.pas
════════════════════════════════════════════════════════════════════════════
Turbo / Borland Pascal are trademarks of Borland International, Inc.